package com.kim.rssreader.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;

import com.kim.rssreader.R;
import com.kim.rssreader.RssApplication;
import com.kim.rssreader.db.DBDAO;

public abstract class BaseActivity extends Activity {

	private static final boolean DEVELOPER_MODE = false;

	RssApplication application = null;
	DBDAO dbDAO = null; // 数据库接口

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		if (DEVELOPER_MODE) {
			StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
					.detectAll().penaltyLog().penaltyDeath().build());
		}

		super.onCreate(savedInstanceState);
		application = (RssApplication) this.getApplication();
		dbDAO = application.getDbDAO();
		initParam();
		initView();
	}

	/**
	 * 初始化视图
	 */
	public abstract void initView();

	/**
	 * 初始化参数
	 */
	public abstract void initParam();

	@Override
	public void startActivity(Intent intent) {
		super.startActivity(intent);
		// 进入activity时动画
		overridePendingTransition(R.anim.slide_right_in, R.anim.slide_left_out);
	}

	@Override
	public void finish() {
		super.finish();
		// 退出activity时动画
		overridePendingTransition(R.anim.slide_left_in, R.anim.slide_right_out);
	}


}
